<div class="content-form edit-aluno">
    <?php echo $this->partial('aluno/menu.phtml', array('urlbase'=>$this->urlbase,'urlfoto'=>$this->urlfoto,'modulo'=>$this->modulo,'controller' => $this->controller, 'action' => $this->action, 'data' => $this->data)); ?>
    
    <div id="content-form">
        
        <div class="content-form-top">
        
            <h2><?php echo $this->Menualuno_nom[$this->action];?></h2>

            <div class="content-tl-btn">
                <span>Nova Opção</span> <a href="javascript:void(0)" class="add_op">+</a>
            </div>
        </div>
        
        <form id="form_aluno" action="" method="post" enctype="application/x-www-form-urlencoded">    
            <input type="hidden" id="ALU_ID" name="ALU_ID" value="<?php echo $this->data['ALU_ID']; ?>" />
            <?php 
            $op_aluno = new Admin_Model_DbTable_AlunoHasOpcaovestibular();
            $where = 'ALU_ID = '.$this->data['ALU_ID'];
            $op_aluno = $op_aluno->fetchAll($op_aluno->select()->where($where)->order('AHO_ID ASC'));
            foreach($op_aluno as $row_op_aluno){ 
            ?>
            <div class="row">
                <a href="javascript:void(0)" onclick="$(this).parent().remove();" style="float: right">excluir</a>
                <div class="ln"><strong style="display: inline-block;width: 135px;">Instituição de Ensino</strong>
                <?php
                    $html = '<select name="FAC_ID[]" class="chosen-select"><option value="0">Nenhum</option>'; // multiple="multiple" style="width: 400px;min-height: 70px;">
                    $query = 'SELECT SQL_CACHE FAC_ID,FAC_NOM FROM FACULDADE WHERE FAC_STA = 1 ORDER BY FAC_NOM ASC';
                    $row = $this->db->fetchAll($query);
                    $arr = array();
                    foreach($row as $r){ 
                        $selected = $r['FAC_ID'] == $row_op_aluno['FAC_ID'] ? 'selected=""':'';            
                        $html .= '<option '.$selected.' value="'.$r['FAC_ID'].'">'.$r['FAC_NOM'].'</option>'; 
                    }
                    echo $html .= '</select>';
                ?>
                </div>
                <div class="ln"><strong style="display: inline-block;width: 135px;">Cursos de Graduação</strong>
                <?php
                    $html = '<select name="CUF_ID[]" class="chosen-select"><option value="0">Nenhum</option>'; // multiple="multiple" style="width: 400px;min-height: 70px;">
                    $query = 'SELECT SQL_CACHE CUF_ID,CUF_NOM FROM CURSOFACULDADE WHERE CUF_STA = 1 ORDER BY CUF_NOM ASC';
                    $row = $this->db->fetchAll($query);
                    $arr = array();
                    foreach($row as $r){  
                        $selected = $r['CUF_ID'] == $row_op_aluno['CUF_ID'] ? 'selected=""':'';
                        $html .= '<option '.$selected.' value="'.$r['CUF_ID'].'">'.$r['CUF_NOM'].'</option>'; 
                    }
                    echo $html .= '</select>';
                ?>
                </div>
                
            </div>
            <?php } ?>
            <script>$(function(){ $('.add_op').click(); });</script>
            <br>
            <div class="row cnt-frm-btn">
                <input type="submit" name="submit" id="submitbutton" value="Salvar" class="btn-frm">

                <a href="<?php echo $this->urlmodulo.'/'.$this->controller; ?>" class="btn-frm">voltar</a>
            </div>
        </form>
    </div>
</div>
